package com.leetcode.string.demo5;

import java.util.Scanner;

/**
 * @Author Zan
 * @Create 2024/6/3 9:28
 * @ClassName: Test
 * @Description : https://kamacoder.com/problempage.php?pid=1065  右旋字符串
 */
public class Test {
    public static void main (String[] args) {
        Scanner sc = new Scanner(System.in);
        int k = sc.nextInt();
        String str = sc.next();
        String s = newStr(str, k);
        System.out.println(s);
    }

    public static String newStr(String s, int k) {
        StringBuffer sb = new StringBuffer();
        int temp = k;
        while (temp > 0) {
            sb.append(s.charAt(s.length() - temp));
            temp--;
        }
        int i = 0;
        while (i < s.length() - k) {
            sb.append(s.charAt(i++));
        }
        return sb.toString();
    }
}
